home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
pdcurs21
/
private
/
_chins.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-18
|
2KB
|
80 lines
#include <string.h>
#define CURSES_LIBRARY 1
#include <curses.h>
#ifdef PDCDEBUG
char *rcsid__chins = "$Header: C:\CURSES\private\RCS\_chins.c 2.1 1993/06/18 20:23:13 MH Rel MH $";
#endif
/*man-start*********************************************************************
PDC_chins() - Low-level insert character in window
PDCurses Description:
This is a private PDCurses routine.
This routine provides the basic functionality for the X/Open
[mv][w]insch() routines. The xlat flag indicates that normal
character translation is performed or not. If not, then the
character is output as is.
The 'xlat' flag is TRUE for the normal curses routines.
PDCurses Return Value:
This function returns OK on success and ERR on error.
PDCurses Errors:
It is an error to call this function with a NULL window pointer.
Portability:
PDCurses int PDC_chins( WINDOW* win, chtype c, bool xlat );
**man-end**********************************************************************/
int PDC_chins(WINDOW *win, chtype c, bool xlat)
{
int retval = ERR;
int x;
int y;
int maxx;
int offset;
chtype* temp1;
char ch = (c & A_CHARTEXT);
#ifdef PDCDEBUG
if (trace_on) PDC_debug("PDC_chins() - called\n");
#endif
if (win == (WINDOW *)NULL)
return( retval );
x = win->_curx;
y = win->_cury;
maxx = win->_maxx;
offset = 1;
temp1 = &win->_y[y][x];
if ((ch < ' ') && xlat)
{
offset++;
}
memmove( temp1+offset, temp1, (maxx - x -offset) * sizeof(chtype) );
win->_lastch[y] = maxx-1;
if ((win->_firstch[y] == _NO_CHANGE) ||
(win->_firstch[y] > x))
{
win->_firstch[y] = x;
}
/*
* PDC_chadd() fixes CTRL-chars too
*/
retval = (PDC_chadd(win, c, xlat,FALSE));
return( retval );
}